/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.capex.javaee.sockets;

import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;

public class saysomethingimp extends UnicastRemoteObject implements saysomething {

    private String name;

    public saysomethingimp(String str) throws
            RemoteException {
        super();
        name = str;
    }

    @Override
    public String talkToMe() throws RemoteException {
        return "Far and Away!";
    }

    public static void main(String args[]) {
//create and install a security manager
        System.setSecurityManager(new RMISecurityManager());
        try {
            saysomethingimp theobj = new saysomethingimp("saysomeserver");
            Naming.rebind("//anyhost/saysomeserver", theobj);
            System.out.println("saysomeserver bound in registry");
        } catch (Exception e) {
            System.out.println("saysomethingimp err: " + e.getMessage());
        }
    }
}
